//
//  UIButton+Setting.m
//  Categorys
//
//  Created by taihankeji on 2017/6/6.
//  Copyright © 2017年 taihankeji. All rights reserved.
//

#import "UIButton+Setting.h"

@implementation UIButton (Setting)

+ (UIButton *)buttonWithTitle:(NSString *)title titleColor:(UIColor *)titleColor {
    UIButton *tempButton = [self buttonWithType:UIButtonTypeCustom];
    [tempButton setTitle:title forState:UIControlStateNormal];
    [tempButton setTitleColor:titleColor forState:UIControlStateNormal];
    return tempButton;
}

+ (UIButton *)buttonWithTitle:(NSString *)title titleColor:(UIColor *)titleColor titleFont:(CGFloat)font {
    UIButton *tempButton = [self buttonWithTitle:title titleColor:titleColor];
    tempButton.titleLabel.font = [UIFont systemFontOfSize:font];
    return tempButton;
}


+ (UIButton *)buttonWithTitle:(NSString *)title titleColor:(UIColor *)titleColor backgrundColor:(UIColor *)backgrundColor {
    UIButton *tempButton = [self buttonWithTitle:title titleColor:titleColor];
    [tempButton setBackgroundColor:backgrundColor];
    return tempButton;
}


+ (UIButton *)buttonWithTitle:(NSString *)title titleColor:(UIColor *)titleColor backgrundImage:(NSString *)imageName {
    
    UIButton *tempButton = [self buttonWithTitle:title titleColor:titleColor];
    [tempButton setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    return tempButton;
}


+ (UIButton *)buttonWithImage:(NSString *)imagename backgroundImage:(NSString *)backgroundImageName {
    UIButton *tempButton = [self buttonWithType:UIButtonTypeCustom];
    [tempButton setImage:[UIImage imageNamed:imagename] forState:UIControlStateNormal];
    [tempButton setBackgroundImage:[UIImage imageNamed:backgroundImageName] forState:UIControlStateNormal];
    return tempButton;
}



+ (UIButton *)buttonWithTitle:(NSString *)title titleColor:(UIColor *)titleColor backgrundColor:(UIColor *)backgrundColor titleFont:(CGFloat)font {
    UIButton *tempButton = [self buttonWithTitle:title titleColor:titleColor backgrundColor:backgrundColor];
    tempButton.titleLabel.font = [UIFont systemFontOfSize:font];
    return tempButton;
}


+ (UIButton *)buttonWithTitle:(NSString *)title titleColor:(UIColor *)titleColor backgrundImage:(NSString *)imageName titleFont:(CGFloat)font {
    UIButton *tempButton = [self buttonWithTitle:title titleColor:titleColor backgrundImage:imageName];
    tempButton.titleLabel.font = [UIFont systemFontOfSize:font];
    return tempButton;
}


@end
